import axios from "@/libs/api.request";
import qs from "querystring";
/**
 * 获取所有学校的列表
 */
export const getAllSchool = async () => {
  return (await axios.request({
    url: 'school/search',
    method: 'get'
  })).data.data;
}

/**
 * 创建学校
 * @param {School}} school 
 */
export const create = async (school) => {
  let data = qs.stringify(school)
  return await axios.request({
    url: '/school/add',
    data,
    method: 'post'
  })
}
/**
 * 修改学校
 * @param {School}} school 
 */
export const edit = async (school) => {
  let data = qs.stringify(school)
  return await axios.request({
    url: '/school/update',
    data,
    method: 'post'
  })
}
/**
 * 删除特定校区
 */
export const remove = async (id) => {
  return axios.request({
    url: 'school/delete?' + qs.stringify({
      ids: id
    }),
    method: 'get'
  });
}
